package brad.zimmerman.dungeon.game;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;



//Determines the shortest path from one point to any other point on the map
public class ClassPlayerPath {
	
	ArrayList<boardPath> _path;
	
	ClassPlayerPath(){
		this._path = new ArrayList<boardPath>();
	}
	
	ArrayList<boardPath> returnArray(){
		return this._path;
	}
	void addPath(int X, int Y){
		boardPath Obj = new boardPath(X,Y);
		this._path.add(Obj);
	}
	int getX(boardPath Obj){
		return Obj.getX();
	}
	int getY(boardPath Obj){
		return Obj.getY();
	}
	void returnSize(){
		System.out.println("Size: " + this._path.size());
	}
	int returnSizeVar(){
		return this._path.size();
	}
	void printPath(){
		int count = 0;
		for (boardPath check: this._path){
			System.out.println(count + " X: "+ check.getX() + " Y: " + check.getY());
			count++;
		}
	}
	boolean inList(int X, int Y){
		for (boardPath check: this._path){
			if (check.getX()==X && check.getY()==Y){
				return true;
			}
		}
		return false;
	}
	boardPath returnTop(){
		return this._path.get(this._path.size()-1);
	}
	void copyReplaceList(ClassPlayerPath _oldPath){
		//this._path.ensureCapacity(_oldPath.size());
		//Collections.copy(this._path, _oldPath);
		for (int i = 0; i < _oldPath.returnSizeVar(); i++){
			this._path.add(_oldPath._path.get(i));
		}
	}
	class boardPath{
		int _x;
		int _y;
		int speed;
		boardPath(int x, int y){
			this._x = x;
			this._y = y;
			this.speed = 1;
		}
		void setX(int x){
			this._x = x;
		}
		void setY(int y){
			this._y = y;
		}
		void setSpeed(int speed){
			this.speed = speed;
		}
		int getX(){
			return _x;
		}
		int getY(){
			return _y;
		}
		int getSpeed(){
			return speed;
		}
	}

}
